<?php

declare(strict_types=1);

namespace App\Fastapp\Model;

use Hyperf\Database\Model\Relations\HasOne;
use Hyperf\Database\Model\SoftDeletes;
use Mine\MineModel;

/**
 * @property int $id 主键
 * @property string $deleted_at 删除时间
 * @property int $user_id 用户id
 * @property int $currency_id 币种id
 * @property string $symbol symbol
 * @property string $address address
 * @property string $balance 资金金额
 * @property string $balance_demo 体验金额
 * @property string $balance_winnings 彩金金额
 * @property string $spot 现货金额
 * @property string $futures 期权金额
 * @property string $contract 合约金额
 * @property string $finance 理财金额
 * @property int $channel
 * @property-read null|Currency $currency
 */
class AccountWallet extends MineModel
{
    use SoftDeletes;

    public bool $timestamps = false;
    /**
     * The table associated with the model.
     */
    protected ?string $table = 'account_wallet';

    /**
     * The attributes that are mass assignable.
     */
    protected array $fillable = ['id', 'deleted_at', 'user_id', 'currency_id', 'symbol', 'address', 'balance', 'balance_demo', 'balance_winnings', 'spot', 'futures', 'contract', 'finance', 'channel'];

    /**
     * The attributes that should be cast to native types.
     */
    protected array $casts = ['id' => 'integer', 'user_id' => 'integer', 'currency_id' => 'integer', 'balance' => 'decimal:8', 'balance_demo' => 'decimal:8', 'balance_winnings' => 'decimal:8', 'spot' => 'decimal:8', 'futures' => 'decimal:8', 'contract' => 'decimal:8', 'finance' => 'decimal:8', 'channel' => 'integer'];

    public function currency(): HasOne
    {
        return $this->hasOne(Currency::class, 'id', 'currency_id');
    }
}
